JDK - Java SE Development Kit
|
Install Java SE Development Kit (JDK) |
|
[1] | Go Sun download site and
Click "JDK 6 Update *" and next, select "linux", then you can download JDK. Next, upload it on your server by FTP and so on. |
[2] | Install JDK |
[root@www ~]# chmod 700 jdk-6u16-linux-x64-rpm.bin [root@www ~]# ./jdk-6u16-linux-x64-rpm.bin ##### read terms of use ##### Do you agree to the above license terms? [yes or no] yes # agree ################################### For more information on what data Registration collects and how it is managed and used, see: http://java.sun.com/javase/registration/JDKRegistrationPrivacy.html Press Enter to continue..... Done. [root@www ~]# vi /etc/profile # add at the bottom
export JAVA=/usr/java/default export PATH=$PATH:$JAVA/bin export CLASSPATH=.:$JAVA/jre/lib:$JAVA/lib:$JAVA/lib/tools.jar [root@www ~]# source /etc/profile
|
[3] | Create a test program and make sure if it is working normally. |
[root@www ~]# vi day.java
import java.util.Calendar;
[root@www ~]# class day { public static void main(String[] args) { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH) + 1; int day = cal.get(Calendar.DATE); int hour = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); System.out.println(year + "/" + month + "/" + day + " " + hour + ":" + minute); } } javac day.java # compile [root@www ~]# java day # run 2008/8/24 21:34 |